package com.lingnan.blog.service;

import com.lingnan.blog.entity.Collect;
import com.lingnan.blog.mapper.CollectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author HeGuanChao
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class CollectService {
    @Autowired
    private CollectMapper collectMapper;

    public Integer saveSelective(Collect collect) {
        return collectMapper.insertSelective(collect);
    }

    public Collect findByUidAndAid(Integer uid, Integer aid) {
        return collectMapper.selectByUidAndAid(uid, aid);
    }

    public Integer removeByUidAndAid(Integer uid, Integer aid) {
        return collectMapper.deleteByUidAndAid(uid, aid);
    }

    public Integer findCountByUid(Integer uid) {
        return collectMapper.countByUId(uid);
    }
}
